<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
#div1 {width:100px; height:100px; background:red; position:absolute; left:0; top:50px;}
</style>
<script>
function startMove()
{
	var oDiv=document.getElementById('div1');
	setInterval(function (){
		console.log('start:',oDiv.offsetLeft);
		
		var speed=(300-oDiv.offsetLeft)/10;
		console.log('end:', speed);
		oDiv.style.left=oDiv.offsetLeft+speed+'px';
	}, 30);
}
</script>
</head>

<body>
<input type="button" value="开始运动" onclick="startMove()" />
<div id="div1">
</div>
</body>
</html>
